/* MAP INITS! */

function Albrook_init()
{	
	//TAKEN FROM MAP PROPERTIES ENTRY SCRIPT
		SetPersonDirection('aguard1', "south");
		SetPersonDirection('meating', "east");
		SetPersonDirection('infoguy', "south");
		SetPersonDirection('dudestinks', "south");
		SetPersonDirection('postman', 'inspect');
		SetPersonDirection('jumpinjackflash',"west");
		SetPersonDirection('chocodelivery', 'faceeast');
		SetPersonDirection('trafficop', 'west');
		SetPersonDirection('oldfogey', 'south');
		SetPersonDirection('floresthump', 'south');
		SetPersonY('floresthump',150);
		SetPersonDirection('magisell', 'south');
		SetPersonX('aguard1', 96);
		SetPersonY('infoguy', 995);
		SetPersonDirection('spect1', 'party1');
		SetPersonDirection('spect2', 'party2');
		SetPersonDirection('spect3', 'cast');
		SetPersonDirection('fire', 'fire');
		SetPersonDirection('blackmark', 'no');
		SetPersonLayer('roofus', 3);
		SetPersonDirection('dudestinks', "south");
		SetPersonDirection('billy', "west");
		SetPersonDirection('bob', "east");
		SetPersonDirection('lonewolf', "east");
		SetPersonDirection('turtletrainer', "west");
		SetPersonDirection('spect4', "east");
		SetPersonY('turtletrainer', 1745);
		SetPersonLayer('turtletrainer', '3');
		SetPersonDirection('pilot', "west");
		SetPersonY('meating', 948);
		SetPersonX('meating', 40);
		SetPersonDirection('birdturd', "peck");
		SetPersonDirection('alleywayjones', "south");
		

	//PRE CHASE STUFF
	if (eventBox['prechase'].inprog)
	{
		if (!rumsbattle.happened)
		{
			//----People with different reactions (to pirate):
			SetPersonScript('loader', 3, 'talkjunk("MAN: Rum? I can\'t drink on the job!");');
			SetPersonScript('blackmark', 3, 'talkjunk(black54);');
			mcm.talkrand = false;
			mcm.talk1 = "GIMMS: The drinks are inside, duh.";
			mcm.talk2 = "GIMMS: Try the Imp Burger!";
			mcm.talk3 = "GIMMS: Want my job?";
			mcm.talk4 = "GIMMS: Come in and try our all new\n99 GP menu!";
			mcm.dirs = new Array('fr','w','r','r','r','w','fd','w','w','w','fr','r','r','r','fl','w','l','l','l','l','l','l');
		}
		else
		{
			SetPersonScript("pilot", 3, 'talkjunk("THIEF: The captain be waitin\' down b\'low.");');
			DestroyPerson('spect1'); DestroyPerson('spect2'); DestroyPerson('spect3');
		}
		// narshe guard parody dude
		if (!brook_invasion.happened)
		{
			queery = new retard('queery', 'Villager13.rss', true);
			SetPersonX('queery',40*16+7); SetPersonY('queery', 90*16+7);
			SetPersonScript('queery', 4, 'walkgay(queery, queery.dirs[queery.step]);');
			SetUpdateScript('prechaseupdate();');
		}
		// annoyinggirl runs around
		SetPersonScript('annoyinggirl', 3, 'runawaygirl();');
		annoyinggirl.dirs = []; annoyinggirl.toobusy = true; annoyinggirl.face=false; annoyinggirl.qpos = 0;
		SetPersonX('annoyinggirl', 26*16+7); SetPersonY('annoyinggirl', 95*16+7);
		SetPersonSpeed('annoyinggirl', 2); SetPersonDirection('annoyinggirl', 'south');
		SetPersonScript('annoyinggirl', 4, 'walkgay(annoyinggirl, annoyinggirl.dirs[annoyinggirl.step]);');
		
		// disgruntledworker admires you
		disgruntledworker.talk1 = "MAN: Whoa, /wthe Crimson Robbers are here! /w\nAhh, the pirate's life... /w/wwish my job was to \ndrink and plunder.";
		disgruntledworker.talk2 = undefined;
		
		// duane is a nerd
		duane = new retard('duane', 'Villager01.rss', true);
		duane = new npcrap('duane');
		SetPersonX('duane', 69*16+7); SetPersonY('duane', 96*16+7);
		SetPersonScript('duane', 4, 'if (duane.step > duane.dirs.length) duane.step=0; walkgay(duane, duane.dirs[duane.step]);');
		duane.dirs = ['fl','w','w','w','w','w','fu','w','w','w','fl','w','w','fd','w','w'];
		duane.talk1 = "DUANE: Are you a newcomer too? /wWe just\nmoved here, I love it!/w Even though the\nbirds ruined my favorite shirt..";
		duane.talk2 = "DUANE: I have to haul all this luggage...\ndid she have to pack so much crap?";
		duane.incremental = true;
		SetPersonScript('duane', 3, 'talkjunk();');
		
		SetPersonScript('infoguy', 3, "talkjunk('MAN: Stay back, ruffian!');");
		snatchee.talk1 = "MAN: You can\'t find rum? Albrook is the\nalcohol center of the world!";
		snatchee.talk2 = "MAN: The bar is right there,/w ya FREAK./w It\nhas your precious rum.";
		SetPersonScript('magisell', 3, "talkjunk('MERCHANT: The only rum I have is in my\\nblood! Good luck on your quest to get\\nsmashed!');");
		
		//The Ultimate Bum:
		SetTile(13,9,1,1035); SetTile(14,9,1,1036);
		if (isdude('Kefka')) DestroyPerson('Kefka');
		Kefka = new retard('Kefka', 'Kefka.rss', true); SetPersonX('Kefka',471); SetPersonY('Kefka',651); SetPersonDirection('Kefka', 'owch');
			
	}
	else if (eventBox['furniture_mission'].inprog)
	{
		if (isdude('vicks') && isdude('wedge'))
		{FollowPerson('vicks', 'wedge', 32); SetPersonLayer('vicks', 1);}	//detach V from couch/tv
		if (BURNT)
		{	//lighting
			SetTile(65,36,4,1116); SetTile(64,37,4,1116); SetTile(65,37,4,1116); SetTile(66,37,4,1116);
			SetTile(64,38,4,1116); SetTile(65,38,4,1116); SetTile(66,38,4,1116); SetTile(64,39,4,1116);
			SetTile(65,39,4,1116); SetTile(66,39,4,1116);
			//broken lamp post
			SetTile(65,36,3,0); SetTile(65,37,3,0); SetTile(65,38,1,1758);  SetTile(66,38,2,1760); SetTile(67,38,2,1761);
		}
	}
	else if (eventBox['vicks_split'].inprog)
	{
	}
	else if (eventBox['wedge_split'].inprog)
	{
		if (!eventBox['aged_clock'].happened)
		{
			SetPersonScript('loader', 3, "talkjunk('MAN: House repair, huh? Screw that!\\nThis job is hard enough!');");
			mcm.talk1 = "GIMMS: Help you fix a house? You must\nthink I'm low class!";
			mcm.talk2 = "GIMMS: I already HAVE a job!";
			mcm.talk3 = "GIMMS: Maybe you should try a McMoogle\nMeal!";
			mcm.talk4 = "GIMMS: Get outta town!";	mcm.talkrand = false;
			SetPersonScript('snatchee', 3, "talkjunk();");
			snatchee.incremental = true;
			snatchee.talk1 = "MAN: You need a helper, eh.../w You probably\nwon\'t find anyone willing in Albrook.";
			snatchee.talk2 = "MAN: This town's full of spoiled rich\npeople. /wThey won't lift a finger when it\ncomes to dirty work.";
			snatchee.talk3 = "MAN: YEP! /wEven me!";
			SetPersonScript('disgruntledworker', 3, "talkjunk('MAN: There was a guy who helped me fix\\nup my roofing. /wLook in the forest, /wwhich\\nis to the east by the junky houses.');");
			SetPersonScript('flashlightjones', 3, "talkjunk();"); flashlightjones.toobusy = false; flashlightjones.face = true;
			flashlightjones.talk1 = "GUARD: A carpenter type of guy sometimes\ndoes odd jobs around here. He could be\nwho you're looking for.";
			flashlightjones.talk2 = "GUARD: He's always playin' around in the\nwoodsy parts... /wright on the edge of\nAlbrook.  /wJust go east.";
		}
		if (eventBox['turtle_boss'].happened)
		{
			SetUpdateScript("updation(); if (Math.abs(GetPersonX(thePC.name) - 50.5*16+7) < 10 && Math.abs(GetPersonY(thePC.name) - 42.5*16+7) < 30 && thempa == 'Albrook.rmp') eventBox['wedge_split_end'].play();");
		}
	}
	else if (eventBox['kefka_split'].inprog)
	{
		SetPersonScript('storyteller', 3, "talkjunk('STORY TELLER: When the fearful Kefka was \\nin power, /whe destroyed towns at will. /wThe \\ntown Tzen to the north was one of those \\ntowns.');");
		shoper.talk1 = "GIRL: Some guy purchased half of \nEquipment Central's stock! /wNow what am I \nsuposed to do? /wTotally ruined my day. \n/w/w/w*sigh* But I better try to stay positive. /wIf \nyou frown too much your face wrinkles!";
		shoper.talk2 = undefined;
		SetPersonScript('richman', 3, "talkjunk('RICHARD: Ol\\' Fitz is a good friend of mine.\\n/wIf you stop by Tzen tell him I said hi.');");
		SetPersonScript('polit', 3, "talkjunk('POLITICIAN: Fitzgerald? He\\'s crooked. /wDon\\'t\\nvote for him if he ever runs for office,\\n/whe\\'ll ruin your life.');");
		SetPersonScript('loader', 3, "talkjunk('MAN: Fitzgerald? /wNever heard of \\'em! /wGet\\noutta here!');");
		SetPersonScript('spect2', 3, "talkjunk('THIEF: Hm, /wFizzharold? /wIs he old? /wBring \\'em\\nto me.');");
		SetPersonScript('postman', 3, "talkjunk('MAIL MAN: A lot of mail does come from\\nFitzgerald, /wbut Tzen isn\\'t my district.');");
		SetPersonScript('pilot', 3, "talkjunk('THIEF: We\\'re Robbin./w./w./w err, /wBOARDIN\\' our\\npassengers for Triangle Island.');");
		SetPersonScript('disgruntledworker', 3, "talkjunk('MAN: Yep, /wThe Power Plant uses shiney\\nrocks, /wsucks the power out of \\'em. /wThat\\'s\\nhow ya get Esper Juice, /wor as some call it \\n\\'electricity\\'.');");
		mcm.talk1 = "GIMMS: I smell something burnt./w./w./w Maybe the\nfry cook cought on fire!";
		mcm.talk2 = "GIMMS: Look I don't know anything about\nthat, /wjust try some Chicken Lip Nuggets";
		mcm.talk3 = undefined; mcm.talkrand = false;
		
		if (!eventBox['eavesdropped'].happened)
		{
			manA = new retard('manA', 'Villager12.rss', true);
			manB = new retard('manB', 'Villager13.rss', true);
			SetPersonX('manA', 18*16+7); SetPersonY('manA', 47*16+7); SetPersonDirection('manA', 'east');
			SetPersonX('manB', 20*16+7); SetPersonY('manB', 47*16+7); SetPersonDirection('manB', 'west');
			SetPersonScript('manA', SCRIPT_ON_ACTIVATE_TALK, "talkjunk('MAN A: Behemoth Burgers rule!');");
			SetPersonScript('manB', SCRIPT_ON_ACTIVATE_TALK, "talkjunk('MAN B: I\\'m getting tired of fast food..');");
			SetUpdateScript('updation(); if (Math.abs(GetPersonX("Kefka") - 20*16+7) <= 100 && Math.abs(GetPersonY("Kefka") - 47*16+7) <= 100 && thempa == "Albrook.rmp") eavesdrop.play();');
				//gets nullfied if rampage hasn't happened
			DestroyPerson('hungryjack');
		}
		if (!eventBox['k_split_rampage'].happened)
		{
			loader.dirs = ['fr'];
			SetUpdateScript("updation(); if (Math.abs(GetPersonX(thePC.name) - 33*16+7) < 64 && Math.abs(GetPersonY(thePC.name) - 86*16+7) < 64) kefka_rampage_0001();");
			//couch movers break 1
			haul1 = new retard('haul1', 'Mover.rss', true);
			SetPersonX('haul1', 36*16+7); SetPersonY('haul1', 109*16+7); SetPersonLayer('haul1', 1);
			SetPersonDirection('haul1', 'east'); SetPersonScript('haul1', 3, "talkjunk('MOVER: Gettin\\'er up these stairs is alotta\\nwork.');");
			haul2 = new retard('haul2', 'Mover.rss', true);
			SetPersonX('haul2', 40.5*16+7); SetPersonY('haul2', 109*16+7); SetPersonLayer('haul2', 1);
			SetPersonDirection('haul2', 'west'); SetPersonScript('haul2', 3, "talkjunk('MOVER: And we gotta haul \\'er all the way\\nup to the wealthy district.');");
			couch = new retard('couch', 'Couch.rss', true);
			SetPersonX('couch', 38.25*16+7); SetPersonY('couch', 109.5*16+7); SetPersonLayer('couch', 1);
			//tonberry
			tony = new retard("tony", "Tonberry.rss", true);
			SetPersonX('tony', 67*16+7); SetPersonY('tony', 91*16+7); SetPersonLayer('tony', 1);
			SetPersonScript('tony', 3, "talkjunk('/w./w./w./w ');"); SetPersonDirection('tony', 'west');
			//onpatrol
			onpatrol.dirs = [];
			SetPersonX('onpatrol', 10.5*16+7); SetPersonY('onpatrol', 75*16+7);
			SetPersonScript('onpatrol', 3, "talkjunk('GUARD: This area\\'s not for clownin\\' around.');");
		}
		else
		{
			//couch movers break 2
			haul2 = new retard('haul2', 'Mover.rss', true);
			SetPersonX('haul2', 38.5*16+7); SetPersonY('haul2', 97*16+7); SetPersonLayer('haul2', 1);
			SetPersonDirection('haul2', 'south'); SetPersonScript('haul2', 3, "talkjunk('MOVER: Time for another break.');");
			couch = new retard('couch', 'Couch.rss', true);
			SetPersonX('couch', 36.5*16+7); SetPersonY('couch', 96*16+7); SetPersonLayer('couch', 1);
			SetPersonDirection('couch', 'lunchbreak'); SetPersonScript('couch', 3, "talkjunk('MOVER: That was way too much work.');");
		}
	}
	
	if (eventBox['splits_closing'].happened)
	{
		// fix tiles n junk
	}
	//DAY OR NITE!
	if (eventBox['furniture_mission'].inprog)	// ||'s
		NightBrook();
	else
	{
		DayBrook();
		AlbrookILEs();
	}
	
	saveable = false;
	//OTHER STUFF! coming soon.	
	/*
	if something, something
	change npcs ontalks..
	K's house repair
	other sheeit
	*/
	
}

function Albrookalley_init()
{
	

}

function Cafebar_init()
{
	if (eventBox['prechase'].inprog)
	{
		SetPersonX("bartender", 11*16+7); SetPersonY("bartender", 24*16+7); SetPersonDirection("bartender", "west");
		eighteen = new retard("eighteen", "blank.rss", true);
		SetPersonX("eighteen", 10*16+7); SetPersonY("eighteen", 24*16+7); SetPersonLayer("eighteen",1);
		SetTile(10,24,0,79); SetTile(10,24,1,0);
		rummy = new retard("rummy", "Merchant.rss", true); SetPersonLayer("rummy",1);//  SetPersonX("rummy", 8*16+7); SetPersonY("rummy", 21*16+7);
		SetPersonScript("rummy", 4, "walkgay(rummy, rummy.dirs[rummy.step]);");
		DestroyPerson('kegfarms');

		
		if (!rumwalk.happened)
		{
			SetPersonX("rummy", 8*16+7); SetPersonY("rummy", 21*16+7); SetPersonDirection('rummy', 'west');
			SetPersonScript('rummy', 3, 'talkjunk("MERCHANT: I gotta check out those dancers!");');
			SetPersonScript('eighteen', 3, 'talkjunk("BARTENDER: The last of the rum was bought by that merchant up there.");');
			rumwalk.play();
		}
		else
		{
			SetPersonX("rummy", 8*16+7); SetPersonY("rummy", 13*16+7); SetPersonDirection('rummy', 'north');
			SetPersonScript("rummy", 3, "rumsbattle.play();");
		}
		if (rumsbattle.happened)
		{
			SetPersonDirection('rummy', 'pushed');
			SetPersonX("rummy", 10*16+7); SetPersonY("rummy", 13.5*16+7);
			SetPersonScript("rummy", 3, 'talkjunk(halby);');
			SetPersonScript("eighteen", 3, 'talkjunk(ebtur);');
			SetPersonX('passedout', 6*16+7); SetPersonY('passedout', 14*16+7);
			SetPersonScript("rummy", 3, 'talkjunk("MERCHANT: I/w./w. hate/w./w. pirates/w...");');
			SetPersonScript("eighteen", 3, 'talkjunk("BARTENDER: Uh.. I would have given you it\\nfor free, of course..");');
		}
	}
	else if (eventBox['wedge_split'].inprog)
	{
		SetPersonScript('thedrunkest', 3, "talkjunk('GUY: Yep, I know a scoundrel who\\'ll work\\nfor ya.  /wLives in the damn forest!');");
	}
	//TOILET GUY!
	mcjohn = new retard('mcjohn', 'Villager13.rss', true); SetPersonX('mcjohn', 2*16+7); SetPersonY('mcjohn', 10.5*16+4); SetPersonDirection('mcjohn', 'south'); SetPersonLayer('mcjohn',0);
	flush = new retard('flush', 'blank.rss', true); SetPersonX('flush', 2*16+7); SetPersonY('flush', 11*16+7);
	SetPersonScript('flush', 3, 'toiletguy();');
	SetTile(2,11,1,0); SetTile(2,11,0,49);
	mrtoilet = new Object();
	mrtoilet.time = GetTime();
	mrtoilet.open = false;
	mrtoilet.hinge = 0;
}

function Magitechstore_init()
{
	if (eventBox['prechase'].inprog)
	{
		if (!rumsbattle.happened)
		{
			SetPersonScript("chatterbox", 3, 'talkjunk("MTEK EXPERT: You\'re looking for rum,/w here? /w/w/wAH/w/w HAHAHA!! /w/w./w./wBring me some if you find any.");');
		}
		else
		{
			SetPersonScript("chatterbox", 3, 'talkjunk("MTEK EXPERT: You can\'t operate a Magitek\\nwhile under the influence, buddy. Gwah ha!");');
			SetPersonScript("travelparts", 3, 'talkjunk("TRAVELING SALESMAN: I STILL sell parts for \\nMagitek Armor.");');
		}
		SetTile(13,12,0,73); SetTile(13,12,1,0);
		DestroyPerson('magitek01');
		DestroyPerson('magitek02');
	}
	else if (eventBox['wedge_split'].inprog)
	{
		SetPersonScript('greasemonkey', 3, 'talkjunk();');
		greasemonkey.talk1 = "WEDGE: I need someone with carpentry\nskills.";
		greasemonkey.talk2 = "GREASE MONKEY: Sure, I'll help you! /w/w/wNOT!";
	}
	else if (eventBox['vicks_split'].inprog)
	{
		if (eventBox['vicks_swindle'].happened)
		{
			if (eventBox['vicks_buymteks'].happened)
			{
				DestroyPerson('shopkeeper');
				SetPersonScript('chatterbox',3,';');	//blocks unobstructed tile
				DestroyPerson('greasemonkey');
				people = GetPersonList();
			}
			else
			{
				SetPersonScript("chatterbox", 3, "eventBox['vicks_buymteks'].play();");
			}
		}
		else	//before the swindle.. no mteks!
		{
			DestroyPerson('magitek01');
			DestroyPerson('magitek02');
		}
	}
	if (eventBox['vicks_split'].happened)
	{
		DestroyPerson('magitek01');
		DestroyPerson('magitek02');
	}
}

function Trishop_init()
{
	if (eventBox['prechase'].inprog)
	{
		SetPersonScript('chatterboxa', 3, "talkjunk('SHOP KEEPER: Why would we sell rum HERE? Go somewhere else ya alcoholic!');");
		SetPersonScript('chatterboxb', 3, "talkjunk('SHOP KEEPER: Me have rum?/w Are you\\nserious?/w Hahaha!/w  That\\'s rich!');");
	}
	if (eventBox['vicks_split'].inprog)
	{
		if (!eventBox['vicks_swindle'].happened)
		{
			SetPersonX('keeper01', 7*16+7); SetPersonY('keeper01', 12*16+7);
			DestroyPerson('representative'); DestroyPerson('chatterboxb'); people = GetPersonList();
			SetTile(1,11,2, 2); SetTile(2,11,2,2); SetTile(3,11,2,2); SetTile(4,11,2,100);
			//eventBox['vicks_swindle'].play();
				// is now executed from the mtek pushing subevent
		}
	}
}

function Mcmoogles_init()
{
	if (eventBox['prechase'].inprog && eventmark < 93)
	{
		DestroyPerson("order");
		counterguy = new retard("counterguy", "blank.rss", true);
		SetPersonX("counterguy", 15*16+7); SetPersonY("counterguy", 13*16+7); SetPersonLayer("counterguy", 1);
		SetPersonScript("counterguy", 3, 'talkjunk(geez3);');
		SetTile(15,13,0,47); SetTile(15,13,1,0); //onTalk won't activate if obstructed
	}
	else if (eventBox['kefka_split'].inprog)
	{
		SetPersonScript('guardb', 3, "talkjunk('GUARD: Franks owes me 20GP, /wwe bet the \\nverdict for Case 88.');");
		SetPersonScript('guarda', 3, "talkjunk('GUARD: I heard from Franks that the fellow \\nfrom Tzen left town.');");
		SetPersonScript('mcmac', 3, "talkjunk('KID: Rich guys are sorta metal.');");
		SetPersonScript('mcmoney', 3, "talkjunk('MERCHANT: I was about to close a deal with \\nsome Tzener here, /wbut he didn\\'t show.');");
	}
	
	McmooglesILEs();
	//GUYS COMING IN AND ORDERING!
	//JUKEBOX 
}

function ChDS_init()
{
	if (eventBox['prechase'].inprog)
	{
		DestroyPerson('gettinzs'); DestroyPerson('outofline'); DestroyPerson('firstinline');
		serviced.talk1 = "MAN: Hey, wanna go on a fishing trip?";
		serviced.talk2 = "CDS WORKER: Yuck, fish.../w But OK.";
		serviced.talk3 = "MAN: Hmm, let\'s see. When\'s good for you?";
		serviced.talk4 = undefined;
	}
}

function Aresidence1_init()
{
	if (eventBox['prechase'].inprog)
	{
		workdude.talk1 = "MAN: Should\'ve locked the door.";
		workdude.talk2 = "MAN: And drawn the shutters.";
	}
}

function Aresidence7_init()
{
	if (eventBox['prechase'].inprog)
	{
		SetTile(8, 10, 2, 88); SetTile(8,9 ,1, 17); SetTile(8,10, 1, 17);
		SetPersonX('loser', 8*16+7); SetPersonY('loser', 10*16+5); SetPersonDirection('loser', 'south');
		loser.talk1 = "BUSINESS MAN: The boss will love this\nreport!";
		loser.talk2 = "My year-long research provides amazing\nstatistics!";
		loser.dirs = [];
		loser.incremental = true;		
	}
}

function Toystore_init()
{
	if (eventBox['prechase'].inprog)
	{
		SetPersonScript('chatterbox', 3, "talkjunk('SHOP KID: This is a toy store, ya dope!\\nYou smell!');");
	}
}

function Ssbarnacles2_init()
{
	if (eventBox['prechase'].inprog)
	{
		DestroyPerson('drunk'); DestroyPerson('drunkenbored'); DestroyPerson('gamble2'); DestroyPerson('moneydude');
		DestroyPerson('waiter'); DestroyPerson('gamble1'); DestroyPerson('gamble3'); DestroyPerson('gamble4');
		if (rumsbattle.happened)
		{
			crash = new retard("crash", "Captaincrash.rss", true); SetPersonDirection('crash', 'east');
			SetPersonX('crash', 17*16+7); SetPersonY('crash', 10*16+7); SetPersonLayer('crash', 1);
			crew1 = new retard('crew1', "Theif01.rss", true); SetPersonDirection('crew1', 'north');
			SetPersonX('crew1', 21*16+7); SetPersonY('crew1', 12*16+7); SetPersonLayer('crew1', 1);
			crew2 = new retard('crew2', "Theif01.rss", true); SetPersonDirection('crew2', 'east');
			SetPersonX('crew2', 17*16+7); SetPersonY('crew2', 11*16+7); SetPersonLayer('crew2', 1);
			crew3 = new retard('crew3', "Theif01.rss", true); SetPersonDirection('crew3', 'north');
			SetPersonX('crew3', 19*16+7); SetPersonY('crew3', 12*16+7); SetPersonLayer('crew3', 1);
			pirateparty.play();	//finishing scene of prechase
		}
	}
}

function Wizhousef1_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		//dragon stuff, huge boss batle, tiger-skin couch is winning prize
	}
}

function Aresidence3_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
		DestroyPerson('chatterbox');
		DestroyPerson('richard3');
		if (!COUCH3 && !thecouch)
		{
			CreatePerson('couch3', 'blank2.rss', true);
			couch3 = new npcrap('couch3');
			SetPersonX('couch3', 12*16+7);
			SetPersonY('couch3', 8*16+7);
			SetPersonScript('couch3', 2, "talkjunk('Take this couch?'); dontproceed=true;");
			couch3.choice = true;
			
			
			couch3.yes = function()
			{
				
				stealcouch3 = new miniscene();
				stealcouch3.play = function()
				{
					thecouch = 1;
					COUCH3 = true;
					pixmov = 0;
					DetachInput();
					DestroyPerson('couch3'); people = GetPersonList();
					SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks', 1);
					FollowPerson('vicks', "", 0);
					IgnorePersonObstructions('vicks', true);
					IgnorePersonObstructions('wedge', true);
					ClearPersonCommands('vicks'); ClearPersonCommands('wedge');
					
					var WYD = GetPersonY('wedge') - (8*16+7);
					SetPersonDirection('wedge', (WYD>0) ? 'north' : 'south');
					for (var p=0; p<Math.abs(WYD); p++)
						QueuePersonCommand('wedge', (WYD>0) ? pcmu : pcmd, false);
						QueuePersonScript('wedge', "SetPersonDirection('wedge', 'east'); SetPersonFrame('wedge', 0);", false);
						
					var VYD = GetPersonY("vicks") - (9*16+7);
					SetPersonDirection('vicks', (VYD>0) ? 'north' : 'south');
					for (var p=0; p<Math.abs(VYD); p++)
						QueuePersonCommand('vicks', (VYD>0) ? pcmu : pcmd, false);
						QueuePersonScript('vicks', 'stealcouch3.proceed = true;', false);
						
				stealcouch3.ateq("");
				stealcouch3.ateq("SetPersonDirection('vicks', 'east'); SetPersonFrame('vicks', 0);");
				stealcouch3.ateq("for (var g=0; g<16*16+7 - GetPersonX('vicks'); g++) QueuePersonCommand('vicks', pcmr, false); QueuePersonScript('vicks', 'stealcouch3.proceed = true;', false);");
				stealcouch3.ateq("for (var b=0; b<8; b++) QueuePersonCommand('wedge', pcmr, false); QueuePersonScript('wedge', 'SetPersonFrame(wedge.name,0);', false); stealcouch3.proceed = false;");
				stealcouch3.ateq("SetPersonDirection('vicks', 'north');");
				stealcouch3.ateq("for (var g=0; g<16; g++) QueuePersonCommand('vicks', pcmu, false); QueuePersonScript('vicks', 'stealcouch3.proceed = true;', false); stealcouch3.proceed = false;");
				stealcouch3.ateq("stealcouch3.proceed = false; SetDelayScript(20, 'stealcouch3.proceed=true;'); SetPersonDirection('vicks', 'west'); SetPersonFrame('vicks', 0);");
				stealcouch3.ateq("SetPersonDirection('wedge', 'crouch2'); SetPersonDirection('vicks', 'crouch');");
				stealcouch3.ateq("couch1 = GetTileImage(101); couch2 = GetTileImage(102); couch3 = GetTileImage(103);");
				stealcouch3.ateq("couch4 = GetTileImage(98); couch5 = GetTileImage(99); couch6 = GetTileImage(100);");
				stealcouch3.ateq("cx = 255; cy = 143;");
				stealcouch3.ateq("SetLayerRenderer(1, 'furn_scene_render();');");
				stealcouch3.ateq("SetTile(13,7,1,0); SetTile(14,7,1,0); SetTile(15,7,1,0); SetTile(13,8,1,96); SetTile(14,8,1,96); SetTile(15,8,1,96); ");
				stealcouch3.ateq("stealcouch3.proceed = false; SetDelayScript(50, 'stealcouch3.proceed=true;');");
				stealcouch3.ateq("SetPersonDirection('wedge', 'heast'); SetPersonDirection('vicks', 'hwest'); cy-=2;");
				stealcouch3.ateq("cy-=2; NOINP=true;");
				stealcouch3.ateq("SetUpdateScript('furniture_scene_update();'); DetachCamera();");
				stealcouch3.ateq("stealcouch3.proceed = false; SetDelayScript(35, 'stealcouch3.proceed=true;');");
				stealcouch3.ateq("SetPersonSpeed('wedge', .75); SetPersonSpeed('vicks', .75);");
				stealcouch3.ateq("for (var g=0; g<80; g++) {QueuePersonCommand('wedge', pcml, false); QueuePersonCommand('vicks', pcml, false); }");
				stealcouch3.ateq("stealcouch3.proceed = false; SetDelayScript(45, 'stealcouch3.proceed=true;');");
				stealcouch3.ateq("dontproceed=true; fadeOutScreen(); dude=new Object();");	//dont display talkchoices during haul
				stealcouch3.ateq("blackout = true;");
				stealcouch3.ateq("ChangeMap('Albrook.rmp'); thempa = 'Albrook.rmp'; people=GetPersonList();");
				stealcouch3.ateq("bgmswitch('music/crickets_loop_004.wav');");
				stealcouch3.ateq("FollowPerson('vicks', '', 0);");
				stealcouch3.ateq("SetPersonX('wedge', 64*16+7); SetPersonY('wedge', 23*16+7); SetPersonX('vicks', 68*16+3); SetPersonY('vicks', 23*16+7);");
				stealcouch3.ateq("SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks', 1);");
				stealcouch3.ateq("SetLayerRenderer(1, 'furn_scene_render();'); NOINP=false;");
				stealcouch3.ateq("dontproceed=true; fadeInScreen();");
				stealcouch3.ateq("stealcouch3.inprog = false; remove(stealcouch3);");
				
				stealcouch3.inprog = true;
				subevq.push(stealcouch3);
				stealcouch3.proceed = false;
				}
				stealcouch3.play();
			}
		}
		if (!TELE3 && !thetele)
		{
			CreatePerson('tele', 'blank.rss', true);
			SetPersonX('tele', 12.5*16+7); SetPersonY('tele', 10*16+7);
			SetPersonScript('tele', 2, 'talkjunk("Take this TV?");');
			tele = new npcrap('tele');
			tele.choice = true;
			
			tele.yes = function()
			{
				TELE3 = true;
				thetele = 1;
				takeappliance(1);
			}
		}
	}
	
	// !eventBox['some-later-event'].happened)  //buys new couch later on..
		if (TELE3 || thetele==1)
		{
			SetTile(13,9,2,0); SetTile(14,9,2,0);
			if (eventBox['furniture_mission'].happened) SetPersonScript('chatterbox', 3, 'talkjunk("RICHARD: I\'ll just get a newer n\'bigger one!");');
		}
		if (COUCH3 || thecouch==1)
		{
			SetTile(13,7,1,30); SetTile(14,7,1,30); SetTile(15,7,1,30);SetTile(13,8,1,96); SetTile(14,8,1,96); SetTile(15,8,1,96);
			if (eventBox['furniture_mission'].happened) SetPersonScript('chatterbox', 3, 'talkjunk("RICHARD: I\'ll just get a newer n\'bigger one!");');
		}
}

function Aresidence3up_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
		richard4.dirs = [];
		SetPersonX('richard4', 17.5*16+7);
		SetPersonY('richard4', 14*16+7);
		SetPersonDirection('richard4', 'east');
		richard2.dirs = [];
		SetPersonX('richard2', 5.5*16+7);
		SetPersonY('richard2', 5*16+7);
		SetPersonDirection('richard2', 'west');
		
		if (!COUCH3UP && !thecouch)
		{
		CreatePerson('c3up', 'blank.rss', true);
		SetPersonX('c3up', 14*16+7); SetPersonY('c3up', 10*16+7);
		SetPersonScript('c3up', 2, 'talkjunk("Take this couch?"); dontproceed=true;');
		c3up = new npcrap('c3up');
		c3up.choice = true;
		
		c3up.yes = function()
		{
			cch = new miniscene();
			cch.play =  function()
			{
				COUCH3UP = true;
				thecouch = 2;
				DetachInput();
				pixmov=0;
				DestroyPerson('c3up'); people = GetPersonList();
				SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks',1);
				IgnorePersonObstructions('vicks', true);
				IgnorePersonObstructions('wedge', true);
				walkdir=0; pixmov=0;
				FollowPerson('vicks', '', 0);
				
				var WYD = 10*16+7 - GetPersonY('wedge');
				SetPersonDirection('wedge', (WYD>0) ? 'south' : 'north');
				for (var r=0; r<Math.abs(WYD); r++)
				QueuePersonCommand('wedge', (WYD>0) ? pcmd : pcmu, false);
				QueuePersonCommand('wedge', pcfr, false);
				QueuePersonScript('wedge', "SetPersonFrame('wedge', 0);", false);
				var VYD = 9*16+7 - GetPersonY('vicks');
				SetPersonDirection('vicks', (VYD>0) ? 'south' : 'north');
				for (var r=0;r<Math.abs(VYD); r++)
				QueuePersonCommand('vicks', (VYD>0) ? pcmd : pcmu, false);
				QueuePersonScript('vicks', 'cch.proceed=true;', false);
				
				cch.ateq("");
				cch.ateq("SetPersonDirection('vicks', 'east');");
				cch.ateq("for (var g=0; g<(14*16+7) - GetPersonX('wedge'); g++) QueuePersonCommand('wedge', pcmr, false);");
				cch.ateq("for (var u=0; u<(18*16+7) - GetPersonX('vicks'); u++) QueuePersonCommand('vicks', pcmr, false);");
				cch.ateq("cch.proceed=false; QueuePersonScript('vicks', 'cch.proceed=true;', false);");
				cch.ateq("QueuePersonCommand('vicks',pcfd,0); for (var b=0; b<16; b++) QueuePersonCommand('vicks', pcmd, false);");
				cch.ateq("cch.proceed=false; QueuePersonScript('vicks', 'cch.proceed=true;', false);");
				cch.ateq("SetPersonDirection('vicks', 'west');");
				cch.ateq("SetPersonDirection('wedge', 'crouch2'); SetPersonDirection('vicks', 'crouch');");
				cch.ateq("cch.proceed=false; SetDelayScript(30,'cch.proceed=true;');");
				cch.ateq("couch1=GetTileImage(85);couch2=GetTileImage(86);couch3=GetTileImage(87);couch4=GetTileImage(82);couch5=GetTileImage(83);couch6=GetTileImage(84);");
				cch.ateq("cx = GetPersonX('vicks')-7; cy=GetPersonY('wedge')+6;");
				cch.ateq("SetLayerRenderer(1,'furn_scene_render();');");
				cch.ateq("SetTile(15,9,2,0); SetTile(16,9,2,0); SetTile(17,9,2,0);SetTile(15,10,1,24); SetTile(16,10,1,24); SetTile(17,10,1,24);");
				cch.ateq("cch.proceed=false; SetDelayScript(30,'cch.proceed=true;');");
				cch.ateq("SetPersonDirection('wedge','heast'); SetPersonDirection('vicks', 'hwest'); cy-=2;");
				cch.ateq("cy-=2; NOINP=true;");
				cch.ateq("SetUpdateScript('furniture_scene_update();'); DetachCamera();");
				cch.ateq("cch.proceed=false; SetDelayScript(30,'cch.proceed=true;');");
				cch.ateq("SetUpdateScript('furniture_scene_update();'); DetachCamera();");
				cch.ateq("SetPersonSpeed('wedge', .75); SetPersonSpeed('vicks', .75);");
				cch.ateq("for (var g=0; g<80; g++) {QueuePersonCommand('wedge', pcmu, false); QueuePersonCommand('vicks', pcmu, false); }");
				cch.ateq("cch.proceed=false; SetDelayScript(10,'cch.proceed=true;');");
				cch.ateq("dontproceed=true; fadeOutScreen(); dude = new Object();");
				cch.ateq("blackout = true;");
				cch.ateq("ChangeMap('Albrook.rmp'); thempa = 'Albrook.rmp'; people=GetPersonList();");
				cch.ateq("bgmswitch('music/crickets_loop_004.wav');");
				cch.ateq("FollowPerson('vicks', '', 0);");
				cch.ateq("SetPersonX('wedge', 64*16+7); SetPersonY('wedge', 23*16+7); SetPersonX('vicks', 68*16+3); SetPersonY('vicks', 23*16+7);");
				cch.ateq("SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks', 1);");
				cch.ateq("SetLayerRenderer(1, 'furn_scene_render();'); NOINP=false;");
				cch.ateq("dontproceed=true; fadeInScreen();");
				cch.ateq("cch.inprog = false; remove(cch);");
				
				cch.ateq("cch.proceed=false;");
				
				cch.inprog=true;
				subevq.push(cch);
			}
			cch.play();
		}
		}
		if (!TELE3UP && !thetele)
		{
			//create onTouch entity
			CreatePerson('teevee', 'blank.rss', true);
			SetPersonX('teevee', 14*16+12); SetPersonY('teevee', 13*16+4); SetPersonLayer('teevee', 1);
			teevee = new npcrap('teevee');
			SetPersonScript('teevee', 2, 'talkjunk("Take this T.V.?"); dontproceed=true;');
			teevee.choice = true;
			teevee.yes = function()
			{
				TELE3UP = true;
				thetele = 2
				takeappliance(1);
			}
		}
	}
	
	if (COUCH3UP || thecouch==2)
	{
		SetTile(15,9,2,0); SetTile(16,9,2,0); SetTile(17,9,2,0);SetTile(15,10,1,24); SetTile(16,10,1,24); SetTile(17,10,1,24);
	}
	if (TELE3UP || thetele==2)
	{
		SetTile(13,13,1,0); SetTile(14,13,1,0); SetTile(13,12,2,0); SetTile(14,12,2,0);SetTile(13,13,3,0); SetTile(14,13,3,0);
		if (eventBox['furniture_mission'].happened)
			SetPersonScript('richard4', 3, "talkjunk('RICHARD: I think father took away my\\ntelevision. Did he find out my secret?');"); 
	}

}

function Aresidence3kit_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
		if (!FRIDGE3 && !thefridge)
		{
			CreatePerson('friggin', 'blank.rss', true);
			friggin = new npcrap('friggin');
			SetPersonX('friggin', 13*16+7); SetPersonY('friggin', 14*16+7); SetPersonLayer('friggin', 1);
			SetPersonScript('friggin', 2, 'talkjunk("Take this fridge?");');
			friggin.choice = true;
			
			friggin.yes = function()
			{
				FRIDGE3 = true;
				thefridge = 1;
				takeappliance(0);
			}
		}
	}
	
	if (FRIDGE3 || thefridge==1)
	{
		SetTile(14,14,1,0); SetTile(14,13,1,41); SetTile(14,12,1,0);
	}
}

function Aresidence2_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
		if (!COUCH2 && !thecouch)
		{
			CreatePerson('c2c', 'blank.rss', true);
			c2c =new npcrap('c2c');
			SetPersonX('c2c', 21*16+7); SetPersonY('c2c', 13*16+7);
			SetPersonScript('c2c', 2, 'talkjunk("Take this couch?");');
			c2c.choice = true;
			
			c2c.yes = function()
			{
				c2 = new miniscene();
				c2.play = function()
				{
					thecouch = 3;
					COUCH2 = true;
					DetachInput();
					pixmov=0;
					FollowPerson('vicks', '', 0);
					DestroyPerson('c2c'); people = GetPersonList();
					ClearPersonCommands('wedge');
					ClearPersonCommands('vicks');
					IgnoreTileObstructions('wedge', true); IgnoreTileObstructions('vicks',true);
					IgnorePersonObstructions('wedge', true); IgnorePersonObstructions('vicks',true);
					SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks',1);
					
					var WXD = (21*16+7) - GetPersonX('wedge');
					QueuePersonCommand('wedge', (WXD>0) ? pcfr : pcfl, false);
					for (var g=0; g<=Math.abs(WXD); g++)
					QueuePersonCommand('wedge', (WXD>0) ? pcmr : pcml, false);
					QueuePersonCommand('wedge', pcfu, false);
					var WYD = GetPersonY('wedge') - (13*16+7);
					for (var w=0; w<=WYD; w++)
					QueuePersonCommand('wedge', pcmu, false);
					QueuePersonCommand('wedge', pcfr, false);
					QueuePersonScript('wedge', 'SetPersonFrame("wedge", 0);', false);
					
					var VYD = GetPersonY('vicks') - (14*16+7);
					QueuePersonCommand('vicks', (VYD>0) ? pcfu : pcfd, false);
					for (var r=0; r<Math.abs(VYD); r++)
					QueuePersonCommand('vicks', (VYD>0) ? pcmu : pcmd, false);
					var VXD = (25*16+7) - GetPersonX('vicks');
					QueuePersonCommand('vicks', (VXD>0) ? pcfr : pcfl, false);
					for (var e=0; e<Math.abs(VXD); e++)
					QueuePersonCommand('vicks', (VXD>0) ? pcmr : pcml, false);
					QueuePersonCommand('vicks', pcfu, false);
					for (var h=0; h<16; h++)
					QueuePersonCommand('vicks', pcmu, false);
					QueuePersonCommand('vicks', pcfl, false);
					QueuePersonScript('vicks', "SetPersonFrame('vicks', 0);", false);
					QueuePersonScript('vicks', 'c2.proceed=true;', false);
					
					c2.ateq("");
					c2.ateq("ClearPersonCommands('wedge'); ClearPersonCommands('vicks');");
					c2.ateq("SetPersonDirection('wedge', 'crouch2'); SetPersonDirection('vicks', 'crouch');");
					c2.ateq("couch1=GetTileImage(118);couch2=GetTileImage(119);couch3=GetTileImage(120);couch4=GetTileImage(115);couch5=GetTileImage(116);couch6=GetTileImage(117);");
					c2.ateq("cx = GetPersonX('vicks')-7; cy = GetPersonY('wedge')+6;");
					c2.ateq("SetLayerRenderer(1, 'furn_scene_render();'); DetachCamera();");
					c2.ateq("SetTile(22,12,1,51); SetTile(23,12,1,51); SetTile(24,12,1,51); SetTile(22,13,1,21); SetTile(23,13,1,21); SetTile(24,13,1,21);");
					c2.ateq("c2.proceed=false; SetDelayScript(30, 'c2.proceed=true;');");
					c2.ateq("SetPersonDirection('wedge', 'heast'); SetPersonDirection('vicks', 'hwest'); cy-=2;");
					c2.ateq("cy-=2; NOINP=true;");
					c2.ateq("SetUpdateScript('furniture_scene_update();'); DetachCamera();");
					c2.ateq("c2.proceed=false; SetDelayScript(30, 'c2.proceed=true;');");
					c2.ateq("for (var h=0; h<34; h++) { QueuePersonCommand('wedge', pcmd, false); QueuePersonCommand('vicks', pcmd, false);}");
					c2.ateq("c2.proceed=false; QueuePersonScript('wedge', 'c2.proceed=true;', false);");
					c2.ateq("for (var u=0; u<50; u++) {QueuePersonCommand('wedge',pcml, false); QueuePersonCommand('vicks', pcml, false);}");
					c2.ateq("c2.proceed=false; SetDelayScript(25, 'c2.proceed=true;');");
					c2.ateq("dontproceed=true; fadeOutScreen(); dude = new Object();");
					c2.ateq("blackout = true;");
					c2.ateq("ChangeMap('Albrook.rmp'); thempa = 'Albrook.rmp'; people=GetPersonList();");
					c2.ateq("bgmswitch('music/crickets_loop_004.wav');");
					c2.ateq("FollowPerson('vicks', '', 0);");
					c2.ateq("SetPersonX('wedge', 44*16+7); SetPersonY('wedge', 10*16+7); SetPersonX('vicks', 48*16+3); SetPersonY('vicks', 10*16+7);");
					c2.ateq("SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks', 1);");
					c2.ateq("SetLayerRenderer(1, 'furn_scene_render();'); NOINP=false;");
					c2.ateq("dontproceed=true; fadeInScreen();");
					c2.ateq("c2.inprog = false; remove(c2);");
					
					c2.inprog=true;
					subevq.push(c2);
				}
				c2.play();
			}
		}
		
		if (!TELE2 && !thetele)
		{
			CreatePerson('tele', 'blank.rss', true);
			SetPersonX('tele', 21*16+7); SetPersonY('tele', 7*16+7);
			SetPersonScript('tele', 2, 'talkjunk("Take this TV?");');
			tele = new npcrap('tele');
			tele.choice = true;
			
			tele.yes = function()
			{
				TELE2 = true;
				thetele=4;
				takeappliance(1);
			}
		}

	}
	if (COUCH2 || thecouch==3)
	{
		SetTile(22,12,1,51); SetTile(23,12,1,51); SetTile(24,12,1,51);
		SetTile(22,13,1,21); SetTile(23,13,1,21); SetTile(24,13,1,21);
	}
	if (TELE2 || thetele==4)
	{
		SetTile(22,4,2,0); SetTile(23,4,2,0);
		SetTile(22,5,2,0); SetTile(23,5,2,0);
		SetTile(22,5,3,121); SetTile(23,5,3,121);	//remove glow of tv screen
	}
}

function Aresidence2up_init()
{
	if (eventBox['prechase'].inprog)
	{
		comfyman.talk1 = "EXEC: What the?! I told you to stop\ndressing like that!";
		comfyman.talk2 = undefined;
		comfyman.talkrand = false;
	}
	if (eventBox['furniture_mission'].inprog)
	{
		if (!COUCH2UP && !thecouch)
		{
			CreatePerson('c2u', 'blank.rss', true);
			c2u = new npcrap('c2u');
			SetPersonX('c2u', 12*16+7); SetPersonY('c2u', 14*16+7);
			SetPersonScript('c2u', 2, 'talkjunk("Take this couch?");');
			c2u.choice = true;
			c2u.yes = function()
			{
				cu = new miniscene();
				cu.play = function()
				{
					c2u.choice=false;
					thecouch = 4;
					COUCH2UP = true;
					DetachInput();
					pixmov=0;
					FollowPerson('vicks', '', 0);
					DestroyPerson('c2u'); people = GetPersonList();
					ClearPersonCommands('wedge'); ClearPersonCommands('vicks');
					IgnoreTileObstructions('wedge', true); IgnoreTileObstructions('vicks',true);
					IgnorePersonObstructions('wedge', true); IgnorePersonObstructions('vicks',true);
					SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks',1);
					
					var VYD = (14*16+7) - GetPersonY('vicks');
					if (VYD>0) QueuePersonCommand('vicks', pcfd, false);
					for (var d=0; d<VYD; d++)	//only go down if he's above couch
					QueuePersonCommand('vicks', pcmd, false);
					var VXD = GetPersonX('vicks') - (12*16+7);
					QueuePersonCommand('vicks', (VXD>0) ? pcfl : pcfr, false);
					for (var d=0; d<Math.abs(VXD); d++)
					QueuePersonCommand('vicks', (VXD>0) ? pcml : pcmr, false);
					var VYD2 = GetPersonY('vicks') - (14*16+7);
					QueuePersonCommand('vicks', (VYD2>0) ? pcfu : pcfd, false);	//doesn't face up if already facing down
					for (var d=0; d<VYD2; d++)
					QueuePersonCommand('vicks', pcmu, false);
					QueuePersonCommand('vicks', pcfl, false);
					QueuePersonScript('vicks', 'SetPersonFrame("vicks", 0);', false);
					
					var WYD = (15*16+7) - GetPersonY('wedge');
					QueuePersonCommand('wedge', (VYD>0) ? pcfd : pcfu, false);
					for (var s=0; s<Math.abs(WYD); s++)
					QueuePersonCommand('wedge', (WYD>0) ? pcmd : pcmu, false);
					QueuePersonCommand('wedge', pcfl, false);
					var WXD = GetPersonX('wedge') - (8*16+7);
					for (var s=0; s<WXD; s++)
					QueuePersonCommand('wedge',pcml, false);
					QueuePersonCommand('wedge', pcfu, false);
					QueuePersonScript('wedge', 'cu.proceed=true;', false);
					
					cu.ateq("");
					cu.ateq("cu.proceed=false; for (var s=0; s<16; s++) QueuePersonCommand('wedge', pcmu, false); QueuePersonScript('wedge', 'SetPersonFrame(wedge.name,0); cu.proceed=true;', false);");
					cu.ateq("SetPersonDirection('wedge', 'crouch2'); SetPersonDirection('vicks', 'crouch');");
					cu.ateq("couch1=GetTileImage(108);couch2=GetTileImage(109);couch3=GetTileImage(110);couch4=GetTileImage(105);couch5=GetTileImage(106);couch6=GetTileImage(107);");
					cu.ateq("cx = GetPersonX('vicks')-7; cy = GetPersonY('wedge')+6;");
					cu.ateq("SetLayerRenderer(1, 'furn_scene_render();'); DetachCamera();");
					cu.ateq("SetTile(9,13,1,43); SetTile(10,13,1,43); SetTile(11,13,1,43); SetTile(9,14,1,91); SetTile(10,14,1,91); SetTile(11,14,1,91);");
					cu.ateq("cu.proceed=false; SetDelayScript(20, 'cu.proceed=true;');");
					cu.ateq("SetPersonDirection('wedge', 'heast'); SetPersonDirection('vicks', 'hwest'); cy-=2;");
					cu.ateq("cy-=2; NOINP=true; BEINGKILLED=4;");
					cu.ateq("SetUpdateScript('furniture_scene_update();');");
					cu.ateq("IgnoreTileObstructions('comfyman',true); SetPersonScript('comfyman', 4, 'walkgay(comfyman, comfyman.dirs[comfyman.step]);');");
					cu.ateq("comfyman.dirs = ['fd','d','d','d','d','d','d','fr','r','cu.proceed=true;']; cu.proceed=false;");
					cu.ateq("talkjunk('EXEC: What? /w/wI didn\\'t order a new couch! /w\\nTake it back!'); dontproceed=true;");
					cu.ateq("cu.proceed=false; SetDelayScript(30, 'cu.proceed=true; BEINGKILLED=0;');");
					cu.ateq("for (var h=0; h<34; h++) { QueuePersonCommand('wedge', pcmr, false); QueuePersonCommand('vicks', pcmr, false);}");
					cu.ateq("cu.proceed=false; SetDelayScript(40, 'cu.proceed=true;');");
					cu.ateq("dontproceed=true; fadeOutScreen(); dude = new Object();");
					cu.ateq("blackout = true;");
					cu.ateq("ChangeMap('Albrook.rmp'); thempa = 'Albrook.rmp'; people=GetPersonList();");
					cu.ateq("bgmswitch('music/crickets_loop_004.wav');");
					cu.ateq("FollowPerson('vicks', '', 0);");
					cu.ateq("SetPersonX('wedge', 44*16+7); SetPersonY('wedge', 10*16+7); SetPersonX('vicks', 48*16+3); SetPersonY('vicks', 10*16+7);");
					cu.ateq("SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks', 1);");
					cu.ateq("SetLayerRenderer(1, 'furn_scene_render();'); NOINP=false;");
					cu.ateq("dontproceed=true; fadeInScreen();");
					cu.ateq("cu.inprog = false; remove(cu);");
				}
				cu.play();
				cu.inprog = true;
				subevq.push(cu);
			}
		}
		if (!FRIDGE2UP && !thefridge)
		{
			CreatePerson('frid', 'blank.rss', true);
			SetPersonX('frid', 3*16+7); SetPersonY('frid', 5.5*16+7);
			frid = new npcrap('frid');
			frid.choice = true;
			SetPersonScript('frid', 2, "talkjunk('Take this fridge?');");
			frid.yes = function()
			{
				dcy = new miniscene();	//dont care yo
				dcy.play = function()
				{
					frid.choice=false;
					dcy.ateq("");
					dcy.ateq("SetPersonScript('comfyman', 4, 'walkgay(comfyman, comfyman.dirs[comfyman.step]);'); IgnoreTileObstructions('comfyman', true);");
					dcy.ateq("comfyman.dirs = ['fu','u','u','fl','dcy.proceed=true;']; dcy.proceed=false;");
					dcy.ateq("talkjunk('EXEC: Stealing my fridge? /w/wGood, /wI\\'ll claim\\ninsurance on it.'); dontproceed=true; winy=173;");
					dcy.ateq("remove(dcy); FRIDGE2 = true; thefridge = 2; takeappliance(0); winy=ybor;");
					subevq.push(dcy);
					dcy.inprog=true;
					dcy.proceed=true;
				}
				dcy.play();
			}
		}	
	}
	
	//--gone permanently--
	if (COUCH2UP || thecouch==4)
	{
		SetTile(9,13,1,43); SetTile(10,13,1,43); SetTile(11,13,1,43);
		SetTile(9,14,1,91); SetTile(10,14,1,91); SetTile(11,14,1,91);
	}
	if (FRIDGE2UP || thefridge==2)
	{
		SetTile(3,5,1,23); SetTile(3,4,1,43); SetTile(3,3,2,0);
	}
}

function Auhouse1_init()
{
	makecouchnfridge();
	if (eventBox['furniture_mission'].inprog)
	{
		keff = new retard('keff', 'Kefka.rss', true);
		SetPersonX('keff', 10*16+7); SetPersonY('keff', 8*16+7);
		SetPersonDirection('keff', 'south');
		SetPersonScript('keff', 3, 'talkjunk("KEFKA: You are not done yet!");');
	}
	if (thetele || eventBox['furniture_mission'].happened)
	{
		SetTile(3,13,2,45); SetTile(4,13,2,46); SetTile(3,14,2,43); SetTile(4,14,2,44);		//tv
	}
}

function makecouchnfridge()
{
	if 	(thecouch==0)	 //couch greenness
	{
		//SetTile(3,11,1,112); SetTile(4,11,1,112); SetTile(5,11,1,112);
		//SetTile(3,12,1,113); SetTile(4,12,1,113); SetTile(5,12,1,113); 
	}
	else if (thecouch==1)
	{
		SetTile(3,11,2,22); SetTile(4,11,2,23); SetTile(5,11,2,24);
		SetTile(3,12,1,19); SetTile(4,12,1,20); SetTile(5,12,1,21); 
	}
	else if (thecouch==2)
	{
		SetTile(3,11,2,28); SetTile(4,11,2,29); SetTile(5,11,2,30); 
		SetTile(3,12,1,25); SetTile(4,12,1,26); SetTile(5,12,1,27); 
	}
	else if (thecouch==3)
	{
		SetTile(3,11,2,10); SetTile(4,11,2,11); SetTile(5,11,2,12); 
		SetTile(3,12,1,7); SetTile(4,12,1,8); SetTile(5,12,1,9); 
	}
	else if (thecouch==4)
	{
		SetTile(3,11,2,16); SetTile(4,11,2,17); SetTile(5,11,2,18); 
		SetTile(3,12,1,13); SetTile(4,12,1,14); SetTile(5,12,1,15); 
	}
	else if (thecouch==5)
	{
		SetTile(3,11,2,34); SetTile(4,11,2,35); SetTile(5,11,2,36); 
		SetTile(3,12,1,31); SetTile(4,12,1,32); SetTile(5,12,1,33); 
	}
	else if (thecouch==6)
	{
		SetTile(3,11,2,4); SetTile(4,11,2,5); SetTile(5,11,2,6); 
		SetTile(3,12,1,1); SetTile(4,12,1,2); SetTile(5,12,1,3); 
	}
	
	if 	(thefridge==0)	//get ridda green!
	{
		//SetTile(7,8,1,93); SetTile(7,9,1,64);
	}
	else if (thefridge==1)	//from Aresidence3kit.rmp
	{
		//SetTile(7,7,2,52); SetTile(7,8,1,51); SetTile(7,9,0,71); SetTile(7,9,1,50);  original boring
		SetTile(7,7,2,49); SetTile(7,8,1,48); SetTile(7,9,0,71); SetTile(7,9,1,47);  //fridge with notes n junk ITS CHRONO'S LOL
	}
	else if (thefridge==2)	//from Exec's house
	{		//BLUE
		SetTile(7,7,2,52); SetTile(7,8,1,51); SetTile(7,9,0,71); SetTile(7,9,1,50); 
	}
	else if (thefridge==3)	//mayor's
	{	//YELLOW
		SetTile(7,7,2,55); SetTile(7,8,1,54); SetTile(7,9,0,71); SetTile(7,9,1,53); 
	}
}

function Auhouse1up_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		FollowPerson('vicks', 'wedge', 32); SetPersonLayer('vicks',2);
	}
}

function Mayorshouse_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		if (!COUCHM && !thecouch)
		{
			CreatePerson('msc', 'blank.rss', true);
			msc = new npcrap('msc');
			SetPersonX('msc', 17*16+7); SetPersonY('msc', 14*16+7);
			SetPersonScript('msc', 2, 'talkjunk("Take this couch?");');
			msc.choice = true;
			msc.yes = function()
			{
				mc = new miniscene();
				mc.play = function()
				{
					thecouch = 5;
					COUCHM = true;
					DetachInput();
					pixmov=0;
					FollowPerson('vicks', '', 0);
					DestroyPerson('msc'); people = GetPersonList();
					ClearPersonCommands('wedge'); ClearPersonCommands('vicks');
					IgnoreTileObstructions('wedge', true); IgnoreTileObstructions('vicks',true);
					IgnorePersonObstructions('wedge', true); IgnorePersonObstructions('vicks',true);
					SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks',1);
					SetPersonLayer('vicks',2);
					GODUDES = 0;	//couch is pulled and vicks is waitin
					
					var WXD = (17*16+7) - GetPersonX('wedge');
					QueuePersonCommand('wedge', (WXD>0) ? pcfr : pcfl, false);
					for (var w=0; w<Math.abs(WXD); w++)
					QueuePersonCommand('wedge', (WXD>0) ? pcmr : pcml, false);
					var WYD = GetPersonY('wedge') - (14*16+7);
					QueuePersonCommand('wedge', (WYD>0) ? pcfu : pcfd, false);
					for (var w=0; w<Math.abs(WYD); w++)
					QueuePersonCommand('wedge', (WYD>0) ? pcmu : pcmd, false);
					QueuePersonCommand('wedge', pcfr, false);
					QueuePersonScript('wedge', 'SetPersonFrame("wedge", 0); mc.proceed=true;', false);
					
					var VYD = GetPersonY('vicks') - (15*16+7);
					QueuePersonCommand('vicks', (VYD>0) ? pcfu : pcfd, false);
					for (var v=0; v<Math.abs(VYD); v++)
					QueuePersonCommand('vicks', (VYD>0) ? pcmu : pcmd, false);
					var VXD = (20*16+7) - GetPersonX('vicks');
					QueuePersonCommand('vicks', pcfr, false);
					for (var v=0; v<VXD; v++)
					QueuePersonCommand('vicks', pcmr, false);
					QueuePersonCommand('vicks', pcfu, false);
					QueuePersonScript('vicks', 'SetPersonFrame("vicks", 0); GODUDES++;', false);
					
					mc.ateq("");
					mc.ateq("SetPersonDirection('wedge', 'heast');");
					mc.ateq("couch1=GetTileImage(65);couch2=GetTileImage(66);couch3=GetTileImage(67);couch4=GetTileImage(62);couch5=GetTileImage(63);couch6=GetTileImage(64);");
					mc.ateq("cx = 335; cy = 239;");
					mc.ateq("SetLayerRenderer(1, 'furn_scene_render();'); DetachCamera();");
					mc.ateq("SetTile(18,13,2,0); SetTile(19,13,2,0); SetTile(20,13,2,0);SetTile(18,14,1,16); SetTile(19,14,1,16); SetTile(20,14,1,16);");
					mc.ateq("for (var g=0; g<16; g++){ QueuePersonCommand('wedge', pcml, false); QueuePersonScript('wedge', 'cx--;', true);} QueuePersonScript('wedge', 'mc.proceed=true;', false); mc.proceed=false;");
					mc.ateq("GODUDES++;");
					mc.ateq("mc.proceed=false; SetUpdateScript('updation(); if (GODUDES==2){SetUpdateScript(\"updation();\"); mc.proceed=true;}');");
					mc.ateq("for (var v=0; v<16; v++) QueuePersonCommand('vicks', pcmu, false); QueuePersonCommand('vicks', pcfl, false); QueuePersonScript('vicks', 'SetPersonFrame(vicks.name,0); mc.proceed=true;', false); mc.proceed=false;");
					mc.ateq("SetPersonDirection('wedge', 'crouch2'); SetPersonDirection('vicks', 'crouch');");
					mc.ateq("mc.proceed=false; SetDelayScript(35, 'mc.proceed=true;');");
					mc.ateq("cy-=2;");
					mc.ateq("cy-=2; SetPersonDirection('wedge', 'heast'); SetPersonDirection('vicks', 'hwest');");
					mc.ateq("SetUpdateScript('furniture_scene_update();');");
					mc.ateq("mc.proceed=false; SetDelayScript(20, 'mc.proceed=true;');");
					mc.ateq("for (var u=0; u<48; u++) { QueuePersonCommand('wedge', pcml,false); QueuePersonCommand('vicks', pcml ,false);}");
					mc.ateq("mc.proceed=false; SetDelayScript(45, 'mc.proceed=true;');");
					mc.ateq("dontproceed=true; fadeOutScreen(); dude = new Object();");
					mc.ateq("blackout = true;");
					mc.ateq("ChangeMap('Albrook.rmp'); thempa = 'Albrook.rmp'; people=GetPersonList();");
					mc.ateq("bgmswitch('music/crickets_loop_004.wav');");
					mc.ateq("FollowPerson('vicks', '', 0);");
					mc.ateq("SetPersonX('wedge', 64*16+7); SetPersonY('wedge', 11*16+7); SetPersonX('vicks', 68*16+3); SetPersonY('vicks', 11*16+7);");
					mc.ateq("SetPersonSpeed('wedge', 1); SetPersonSpeed('vicks', 1);");
					mc.ateq("SetLayerRenderer(1, 'furn_scene_render();'); NOINP=false;");
					mc.ateq("dontproceed=true; fadeInScreen();");
					mc.ateq("mc.inprog = false; remove(mc);");
					mc.inprog=true;
					subevq.push(mc);				
				}
				mc.play();
			}
		}
		
		if (!FRIDGEM && !thefridge)
		{
			CreatePerson('fridgin', 'blank.rss', true);
			fridgin = new npcrap('fridgin');
			SetPersonX('fridgin', 9*16+7); SetPersonY('fridgin', 16*16+7); SetPersonLayer('fridgin', 1);
			SetPersonScript('fridgin', 2, 'talkjunk("Take this fridge?");');
			fridgin.choice = true;
			
			fridgin.yes = function()
			{
				FRIDGEM = true;
				thefridge = 3;
				takeappliance(0);
			}
		}
		
		if (!TELEM && !thetele)
		{
			CreatePerson('tele', 'blank.rss', true);
			SetPersonX('tele', 17*16+7); SetPersonY('tele', 16*16+7);
			SetPersonScript('tele', 2, 'talkjunk("Take this TV?");');
			tele = new npcrap('tele');
			tele.choice = true;
			
			tele.yes = function()
			{
				TELEM = true;
				thetele = 3;
				takeappliance(1);
			}
		}
	}

	if (COUCHM || thecouch==5)	//gone with the couch
	{
		SetTile(18,13,2,0); SetTile(19,13,2,0); SetTile(20,13,2,0);
		SetTile(18,14,1,16); SetTile(19,14,1,16); SetTile(20,14,1,16);
	}
	if (FRIDGEM)	//gone forever
	{
		SetTile(8,16,1,0); SetTile(8,15,1,115); SetTile(8,14,2,0);
	}
	if (TELEM)	//tv was stolen (change the tiles!)
	{
		SetTile(18,15,2,0); SetTile(19,15,2,0);
		SetTile(18,16,2,0); SetTile(19,16,2,0);
	}
	
}

function Mayorsupstairs_init()
{
	if (eventBox['furniture_mission'].happened)
	{
		if (CHOUCHM || FRIDGEM || TELEM)
		{
			SetPersonScript('mayor', 3, "talkjunk('MAYOR: ALIENS stole my furniture!!');");
		}
	}
}

function Aresidence8_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
		SetLayerVisible(4, true);
		
		forbid = new miniscene();
		forbid.play = function()
		{
			remove(timewarping); thempa = 'Aresidence8.rmp';
			//input n junk
			dispTown = false;
			FollowPerson('vicks', '', 0); SetPersonX('vicks', 2500);
			DetachInput(); DetachCamera(); ClearPersonCommands('wedge'); ClearPersonCommands('vicks');
			SetPersonDirection('wedge', 'north');SetPersonSpeed('wedge', 1); SetPersonY('wedge', 20*16+7);
			bgmswitch('music/OneWingedMoogle.it', true, true); fadeInScreen(); dontproceed=true;
			
				//screen goes red, layer zooms, beast commands you exit
			forbid.ateq("");
			forbid.ateq("for (var b=0; b<32; b++) QueuePersonCommand('wedge', pcmu, false); QueuePersonScript('wedge', 'forbid.proceed=true;', false); forbid.proceed=false;");
			forbid.ateq("SetPersonDirection('wedge', 'shocked');");
			forbid.ateq("talkjunk('DEMON: YOU SHALL NOT PASS!!'); dontproceed=true;");
			forbid.ateq("SetDelayScript(25, 'forbid.proceed=true;'); forbid.proceed=false;");
			forbid.ateq("SetPersonSpeed('wedge', 2); SetPersonDirection('wedge', 'south');");
			forbid.ateq("for (var g=0; g<32; g++) QueuePersonCommand('wedge', pcmd, false); QueuePersonScript('wedge', 'forbid.proceed=true;', false); forbid.proceed=false;");
			forbid.ateq("fadeOutScreen(); dontproceed=true;");
			forbid.ateq("blackout=true;");
			forbid.ateq("FollowPerson('vicks', 'wedge', 32); AttachInput('wedge'); AttachCamera('wedge');");
			forbid.ateq("ChangeMap('Albrook.rmp'); SetPersonX('wedge', 50*16+7); SetPersonY('wedge', 22*16+7);");
			forbid.ateq("bgmswitch('music/crickets_loop_004.wav');");
			forbid.ateq("fadeInScreen(); dontproceed=true; forbid.inprog=false; remove(forbid);");

			forbid.inprog=true;
			subevq.push(forbid);
		}
		forbid.play();
	}
}

function CDS_init()
{
	if (eventBox['prechase'].inprog)
	{
		// fishing and sheit?1
	
	}
}

function blank_init()
{
	if (eventBox["splits"].inprog)	//always false on gameboot
	{
		dispTownsave = "End of Time";
		if (isdude("Ultros")) DestroyPerson('Ultros');
		if (isdude(thePC.name)) DestroyPerson(thePC.name);
		choosy = new retard("Ultros", "Ultros.rss", true);	
		thePC = choosy; ClearPersonCommands(thePC.name); thePC.dirs = [];
		party = new Array("Ultros");
		initGame(true);
		DetachCamera();
		SetCameraX(160); SetCameraY(120);
		saveable = false;
		bgmswitch();
		
		if (!eventBox['kefka_split'].happened) theK_placement(); else theDUDE_placement("k",160,210);
		if (!eventBox['wedge_split'].happened) theW_placement(); else theDUDE_placement("w",60,160);
		if (!eventBox['vicks_split'].happened) theV_placement(); else theDUDE_placement("v",260,160);
		savept = new npcrap('savept'); CreatePerson('savept', 'Save.rss', true);
		people = GetPersonList();
		
		SetPersonX(thePC.name, 160); SetPersonY(thePC.name, 50); SetPersonDirection(thePC.name, "south");
		SetPersonX('savept', 160); SetPersonY('savept', 110); SetPersonDirection('savept', 'saveit');
		savept.dirs = new Array("SetPersonFrame('savept', 0);",';',';',';',';',';',  "SetPersonFrame('savept', 1);",';',';',';',';',';',  "SetPersonFrame('savept', 2);",';',';',';',';',';',  "SetPersonFrame('savept', 3);",';',';',';',';',';');
		SetPersonScript('savept', 4, "if (savept.step>=savept.dirs.length) savept.step=0; walkgay(savept, savept.dirs[savept.step]);");
		SetPersonScript('savept', 2, "flicker();");
		
		if (eventBox['kefka_split'].happened && eventBox['wedge_split'].happened && eventBox['vicks_split'].happened)
		{
			eventBox['splits_closing'].play();
		}
		
	}
}

function theK_placement()
{
		theK = new npcrap("theK"); CreatePerson("theK", "Kefka.rss", true);
		SetPersonX("theK", 160); SetPersonY("theK", 210); SetPersonDirection("theK", "south");

		kefka_junk = function()
		{
			theK.dirs = new Array('w', "SetPersonDirection('theK', 'laugh');", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 1);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 0);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 1);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 0);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 1);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 0);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 1);", ';', ';', ';', ';', ';',
							'w', 'w', "SetPersonDirection('theK', 'anger');", 'w', 'w', 
							"SetPersonDirection('theK', 'nono'); SetPersonFrame('theK', 0);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 1);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 0);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 1);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 0);", ';', ';', ';', ';', ';',
							"SetPersonFrame('theK', 1);", ';', ';', ';', ';', ';', 'w');							
			SetPersonScript('theK', 4, "if (theK.step>theK.dirs.length) theK.step=0; walkgay(theK, theK.dirs[theK.step]);");
			theK.step=0; theK.mark=0;
			talkjunk('Kefka is wandering around in Albrook,\nbut is that really safe? He was just\nthrown in jail! Something is bound to\nhappen...');
			SetPersonScript('theK', 3, "if (justtalked) kefka_junk2();");
		}
		kefka_junk2 = function()
		{
			SetPersonScript('theK', 3, ';');
			dude = theK;	justtalked = false;
			talkjunk("Follow Kefka?"); theK.choice = true;
			theK.yes = function()
			{resetTalk(); theK.choice=false; eventBox['kefka_split'].play();}
			theK.no = function()
			{resetTalk(); SetDelayScript(2, "SetPersonScript('theK', 3, 'kefka_junk();');"); theK.dirs = new Array('fd'); theK.choice=false; SetPersonFrame('theK', 0);}
		}
		SetPersonScript('theK', 3, "kefka_junk();");
		theK.toobusy = true; theK.face = false;
}

function theW_placement()
{
		theW = new npcrap("theW"); CreatePerson("theW", "Brown.rss", true);
		SetPersonX("theW", 60); SetPersonY("theW", 160); SetPersonDirection("theW", "south");

		wedge_junk = function()
		{
			SetPersonDirection('theW', 'salute');
			talkjunk('Wedge needs to get the house repaired,\nbut the problem is, he has no carpentry\nskills. He must seek out someone who does.\nWho will he find?');
			SetPersonScript('theW', 3, "if (justtalked) wedge_junk2();");
		}
		wedge_junk2 = function()
		{
			SetPersonScript('theW', 3, ';');
			dude = theW;	justtalked = false;
			talkjunk("Follow Wedge?"); theW.choice = true;
			theW.yes = function()
			{resetTalk(); theW.choice=false; eventBox['wedge_split'].play(); }
			theW.no = function()
			{resetTalk(); SetDelayScript(2, "SetPersonScript('theW', 3, 'wedge_junk();');"); theW.choice = false; SetPersonDirection('theW', 'south');}
		}
		SetPersonScript("theW", 3, "wedge_junk();");
		theW.toobusy = true; theW.face = false;
}

function theV_placement()
{
		theV = new npcrap("theV"); CreatePerson("theV", "Brown.rss", true);
		SetPersonX("theV", 260); SetPersonY("theV", 160); SetPersonDirection("theV", "south");
		
		vicks_junk = function()
		{
			theV.dirs = new Array('SetPersonDirection("theV", "fire");',
				'SetPersonFrame("theV", 0);', 'w', 'w',		'SetPersonFrame("theV", 1);', 'w',
				'SetPersonFrame("theV", 2);', ';', ';', ';',	'SetPersonFrame("theV", 1);',';', ';', ';', ';', ';', ';',
				'SetPersonFrame("theV", 2);', ';', ';', ';', ';',	'SetPersonFrame("theV", 1);', ';', ';', ';', ';', ';', ';', ';', ';');
			theV.step=0; theV.mark=0;
			SetPersonScript("theV", 4, "if (theV.step>theV.dirs.length) theV.step=0; walkgay(theV, theV.dirs[theV.step]);");
			talkjunk('Vicks is supposed to acquire an arsenal of\nbasic weapons and equipment to help\nkickstart the new Empire\'s reign. Will he\nsucceed? Let\'s see...');
			SetPersonScript('theV', 3, "if (justtalked) vicks_junk2();");
		}
		vicks_junk2 = function()
		{
			SetPersonScript('theV', 3, ";");
			dude = theV;
			justtalked = false;
			talkjunk("Follow Vicks?");
			theV.choice = true;
			theV.yes = function()
			{resetTalk(); theV.choice=false; eventBox['vicks_split'].play(); }
			theV.no = function()
			{resetTalk(); SetDelayScript(2, "SetPersonScript('theV', 3, 'vicks_junk();');"); theV.dirs=new Array('fd'); theV.choice=false; SetPersonFrame('theV', 0);}
		}	

		SetPersonScript('theV', 3, "vicks_junk();");
		theV.toobusy = true; theV.face = false;
}

function theDUDE_placement(i,x,y)
{
	if (i=="k")
	{
		kguitar = new npcrap("kguitar"); CreatePerson("kguitar", "GuitarGuy.rss", true);
		SetPersonX('kguitar', x); SetPersonY('kguitar', y); 
		SetPersonScript('kguitar', 4, 'if (kguitar.step>kguitar.dirs.length) kguitar.step=0; walkgay(kguitar, kguitar.dirs[kguitar.step]);');
		SetPersonScript('kguitar', 3, 'talkjunk("You have already completed this section.\\nRock on!");');
		kguitar.dirs = [
			"SetPersonDirection('kguitar', 'shred');",
			"SetPersonFrame('kguitar', 0);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('kguitar', 2);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('kguitar', 3);",';',';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';',
			"SetPersonFrame('kguitar', 1);",';',';',';',"SetPersonFrame('kguitar', 4);",';',';',';'
		];
		kguitar.toobusy = true; kguitar.face = false;
	}
	else if (i=="w")
	{
		wguitar = new npcrap("wguitar"); CreatePerson("wguitar", "GuitarGuy.rss", true);
		SetPersonX('wguitar', x); SetPersonY('wguitar', y); 
		SetPersonScript('wguitar', 4, 'if (wguitar.step>wguitar.dirs.length) wguitar.step=0; walkgay(wguitar, wguitar.dirs[wguitar.step]);');
		SetPersonScript('wguitar', 3, 'talkjunk("You have already completed this section.\\nRock on!");');
		wguitar.dirs = [
			"SetPersonDirection('wguitar', 'shred');",
			"SetPersonFrame('wguitar', 0);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('wguitar', 2);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('wguitar', 3);",';',';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';',
			"SetPersonFrame('wguitar', 1);",';',';',';',"SetPersonFrame('wguitar', 4);",';',';',';'
		];
		wguitar.toobusy = true; wguitar.face = false;
	}
	else if (i=="v")
	{
		vguitar = new npcrap("vguitar"); CreatePerson("vguitar", "GuitarGuy.rss", true);
		SetPersonX('vguitar', x); SetPersonY('vguitar', y); 
		SetPersonScript('vguitar', 4, 'if (vguitar.step>vguitar.dirs.length) vguitar.step=0; walkgay(vguitar, vguitar.dirs[vguitar.step]);');
		SetPersonScript('vguitar', 3, 'talkjunk("You have already completed this section.\\nRock on!");');
		vguitar.dirs = [
			"SetPersonDirection('vguitar', 'shred');",
			"SetPersonFrame('vguitar', 0);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('vguitar', 2);",';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('vguitar', 3);",';',';',';',';',';',';',';',';',';',';',';',';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';',
			"SetPersonFrame('vguitar', 1);",';',';',';',"SetPersonFrame('vguitar', 4);",';',';',';'
		];
		vguitar.toobusy = true; vguitar.face = false;
	}
}

function Jail_init()
{
	if (eventBox['prechase'].inprog)
	{
		SetPersonScript('sleepy', 3, "talkjunk('GUARD: Jail food is delicious! Mwahaha!');");
	}
	if (eventBox['jail_scene'].inprog)
	{	
		if (isdude('Kefka')) DestroyPerson('Kefka');	//could be non-destroy on mapchange
		Kefka = new retard('Kefka', 'Kefka.rss', true); thePC = Kefka;
		AttachInput(thePC.name); AttachCamera(thePC.name);
		if (!isdude('vicks'))
		vicks = new retard('vicks', 'Brown.rss', true); SetPersonLayer('vicks', 0); SetPersonX('vicks', 16.5*16+7); SetPersonY('vicks', 16);
		if (!isdude('wedge'))
		wedge = new retard('wedge', 'Brown.rss', true); SetPersonLayer('wedge', 0); SetPersonX('wedge', 17.5*16+7); SetPersonY('wedge', 16);
		SetPersonScript('vicks', 4, 'walkgay(vicks, vicks.dirs[vicks.step]);');
		SetPersonScript('wedge', 4, 'walkgay(wedge, wedge.dirs[wedge.step]);');
		SetPersonScript('Kefka', 4, 'walkgay(Kefka, Kefka.dirs[Kefka.step]);');
	
		saver = new retard('saver', 'Save.rss', true); SetPersonDirection('saver', 'saveit'); SetPersonX('saver', 20.5*16+7); SetPersonY('saver', 7*16+7);
		saver.dirs=new Array('SetPersonFrame(saver.name, 0);',';',';',';',';',';',  'SetPersonFrame(saver.name, 1);',';',';',';',';',';',  'SetPersonFrame(saver.name, 2);',';',';',';',';',';',  'SetPersonFrame(saver.name, 3);',';',';',';',';',';');
		SetPersonScript('Kefka', 4, 'walkgay(Kefka, Kefka.dirs[Kefka.step]);');
		SetPersonScript('saver', 2, 'flicker();');
		SetPersonScript('saver', 4, 'if (saver.step>saver.dirs.length) saver.step=0; walkgay(saver, saver.dirs[saver.step]);');

		bedgoer = new retard('bedgoer', 'blank.rss', true);
		bedgoer = new npcrap('bedgoer');
		SetPersonX('bedgoer', 15*16+7);
		SetPersonY('bedgoer', 5.5*16+7);
		SetTile(15,5,0,56); SetTile(15,5,1,0);
		SetTile(15,6,0,55); SetTile(15,6,1,0);
		SetPersonScript('bedgoer', 2, 'talkjunk("Be a bedgoer?");');
		bedgoer.choice = true;
		bedgoer.yes = function()
		{
			resetTalk();
			afterbed();
		}
	}

}

function JonesRd_init()
{
	if (eventBox['wedge_split'].inprog)
	{
		if (!eventBox['aged_clock'].happened)
		{
			trig = new retard('trig', 'blank2.rss', true);
			SetPersonX('trig', 7*16+7);
			SetPersonY('trig', 9*16+7);
			SetPersonScript('trig', 2, "eventBox['aged_clock'].play();");
		}
	}
}

function JonesHouse_init()
{
	//if (maineventsareclean()) bgmswitch('music/Maximum_Senility.it', true, true);	//dont fade OUT, dont fade IN
}

function Aforest1_init()
{
	saveable = false;
	//if (maineventsareclean()) bgmswitch('music/MysticForest.it', false, true);
}

function Aforest2_init()
{
	SetUpdateScript("restrictCamY(7*16+7); updation();");
	if (eventBox['wedge_split'].inprog)
	{
		if (!eventBox['turtle_kick'].happened)
		{
			SetPersonX('raph', 19*16+7); SetPersonY('raph', 10*16+7); SetPersonDirection('raph', 'west');
			raph.dirs = []; 
			SetUpdateScript("updation(); if (Math.abs(GetPersonX(thePC.name) - 18*16+7) < 35 && Math.abs(GetPersonY(thePC.name) - 10*16+7) < 64 && thempa=='Aforest2.rmp') eventBox['turtle_kick'].play();");
		}
		else
		{
			DestroyPerson('raph');
			if (!eventBox['turtle_boss'].happened && eventBox['aged_clock'].happened)
			{
				//huge mutant turtle gets revenge
				SetUpdateScript("updation(); restrictCamY(7*16+7); if (Math.abs(GetPersonX(thePC.name) - 20*16+7) < 40 && Math.abs(GetPersonY(thePC.name) - 10*16+7) < 64 && thempa=='Aforest2.rmp') eventBox['turtle_boss'].play();");
				SetLayerRenderer(1,"drawturtleshells();");
			}
		}
	}
}

function Aforest2_exit()
{
	SetUpdateScript("updation();");
	AttachCamera(thePC.name);
	if (eventBox['wedge_split'].inprog)
	{
		SetLayerRenderer(1, "");
	}
}

function Aforest4_init()
{
	showtheFinger = true;
	SetDelayScript(50, 'showtheFinger=false;');
}

function Aforest5_init()
{
	saveable = false;
	//if (maineventsareclean()) bgmswitch('music/MysticForest.it', false, true);
}

function Tzen_init()
{
	if (eventBox['kefka_split'].inprog)
	{
		SetPersonScript('bricks', 3, "talkjunk('MAN: Work work work. /wBeen fixin\\' this \\ntown for a year now, /wthanks to Kefka. /wIf \\nhe was alive I\\'d thank him personally!');");
		SetPersonScript('walledge', 3, "talkjunk('MAN: Fitzgerald? /w/wHe just came back \\nunfortunately. /wHe lives in the HUGE house \\nthat eclipses the entire town, /wcan\\'t miss it.');");
		SetPersonScript('helper', 3, "talkjunk('MAN: Mr. Fitzgerald exploits loopholes in \\nthe law to maintain his fortune! /wThe people \\nof Tzen want him outta here!');");
		SetPersonScript('warner', 3, "talkjunk('OLD WOMAN: Mr. Fitzgerald cares only for \\nmoney. /wHans, /whis butler, /whowever, /wis a very \\nnice man, /wand he has rugged good looks.');");
		SetPersonScript('complaints', 3, "talkjunk('LADY: My husband sleeps with his money.');");
		SetPersonScript('childlabor', 3, "talkjunk('KID: Mr Fitzgeraldo is a supporter of child \\nlabor, /wand I thank him.');");
		SetPersonScript('sharddealer', 3, "talkjunk('THIEF: Fitzgerald brought out my supply. /wIf \\nyou want shards, /wgo make a deal with that \\nTycoon.');");
		if (!eventBox['tzen_welcome'].happened && eventBox['k_split_rampage'].happened)
		{
			eventBox['tzen_welcome'].play();
		}
	}
}

function Tzenrichyrichbasement_init()
{
	if (!eventBox['fitz_battle'].happened && eventBox['kefka_split'].inprog)
	{
		fitz = new retard('fitz', 'Fitz.rss', true);
		SetPersonX('fitz', 11*16+7); SetPersonY('fitz', 12.5*16+7); SetPersonLayer('fitz', 1);
		SetPersonDirection('fitz', 'east');
	}

}

function Asewer1_init()
{
	saveable = false;
	if (eventBox['vicks_split'].inprog)
	{
		if (eventBox['vicks_buymteks'].happened)
		{
			if (!turtlelude.happened)
			{
				renchy = new retard('renchy', 'WrenchTurtle.rss', true);
				SetPersonX('renchy', 11*16+7); SetPersonY('renchy', 26*16+7); SetPersonLayer('renchy', 1);
				SetPersonScript('renchy', 4, 'walkgay(renchy, renchy.dirs[renchy.step]);');
				SetPersonScript('renchy', 3, 'turtlelude.play();');			
//			}
//			else		//THESE HAPPEN SIMULTANEOUSLY FOR NOW, flee scene triggers other events to be available
//			{			//LATER STICK THIS BLOCK INTO THE FLEE SCENE so its a sequence
				SetPersonSpriteset('turtle3', LoadSpriteset('WrenchTurtle.rss'));
				scenetrig321 = new retard('scenetrig321', 'blank.rss', true);
				SetPersonX('scenetrig321', 65*16+7); SetPersonY('scenetrig321', 29*16+7); SetPersonLayer('scenetrig321', 1);
				scenetrig321 = new retard('scenetrig322', 'blank.rss', true);
				SetPersonX('scenetrig322', 66*16+7); SetPersonY('scenetrig322', 29*16+7); SetPersonLayer('scenetrig322', 1);
				SetPersonScript('scenetrig321', 2, 'scenetrig321_bX14.play();');
				SetPersonScript('scenetrig322', 2, 'scenetrig321_bX14.play();');
						
			}
			if (!eventBox['sewerboss01'].happened)
			{
				//SetPersonScript('treasure3', 3, "eventBox['sewerboss01'].play();");
				//SetUpdateScript("updation(); if (Math.abs(GetPersonX(thePC.name) - 4*16+7) < 32 && Math.abs(GetPersonY(thePC.name) - 32*16+7) < 16 && thempa == 'Asewer1.rmp') findanotherway.play();");
			}
		}
	}
}

function Oldshouse_init()
{
	if (eventBox['prechase'].inprog)
	{
		if (!rumsbattle.happened)
		{
			notrum = new retard('notrum', 'blank.rss', true);
			notrum = new npcrap('notrum');
			SetPersonX('notrum', 4*16+7); SetPersonY('notrum', 6*16+7); SetPersonLayer('notrum', 1);
			SetPersonScript('notrum', 3, "talkjunk();");
			notrum.talk1 = "This is not rum."
			notrum.talk2 = "It's grapefruit juice!";
			notrum.incremental = true;
		}
	}
}

function Auhouse2_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
	}
}

function Auhouse2up_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
	}
}

function Auhouse3_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
	}
}

function Auhouse3up_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
	}
}

function Auhouse4_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
	}
}

function Auhouse4up_init()
{
	if (eventBox['furniture_mission'].inprog)
	{
		SetLayerVisible(3, true);
	}
}

function Worldmap_init()
{
	if (thePC.rss == "Kefka.rss")
	{
		DestroyPerson(thePC.name);
		thePC = new retard("Kefka", "Mapkefka.rss", false);
		checkidle=false;
		AttachInput(thePC.name);
		AttachCamera(thePC.name);
		//SetRenderScript("worldmapfuckdation();");
	}

/*	SetUpdateScript("mapdation();");
	SetRenderScript("mapdition();");
	if (charstats[party[0]].rss == "Kefka.rss");
	DestroyPerson(thePC.name);
	thePC = new retard(party[0], "blank.rss", false);
	AttachInput(thePC.name); AttachCamera(thePC.name);
	assfoo = LoadSpriteset('Mapkefka.rss').images[0];
*/
}

function Worldmap_exit()
{
	if (thePC.rss == "Mapkefka.rss")
	{
		DestroyPerson(thePC.name);
		thePC = new retard("Kefka", "Kefka.rss", false);
		AttachInput('Kefka');
		AttachCamera('Kefka');
		checkidle=true;
	}
}

